package com.cyanite.playlv2api.types;

import com.cyanite.playlv2api.util.ConstantsUtils;
import com.cyanite.playlv2api.util.ParcelUtils;

import android.os.Parcel;
import android.os.Parcelable;

public class TaskCategory implements PlayLv2Type, Parcelable {

    private String mId;
    private int mType;
    private int mTasksUnDone;

    public TaskCategory()  {

    }

    private TaskCategory(Parcel in) {
        mId = ParcelUtils.readStringFromParcel(in);
        mType = Integer.valueOf(ParcelUtils.readStringFromParcel(in));
        mTasksUnDone = Integer.valueOf(ParcelUtils.readStringFromParcel(in));
    }

    @Override
    public void writeToParcel(Parcel out, int flags) {
        ParcelUtils.writeStringToParcel(out, mId);
        ParcelUtils.writeStringToParcel(out, String.valueOf(mType));
        ParcelUtils.writeStringToParcel(out, String.valueOf(mTasksUnDone));
    }

    public static final Parcelable.Creator<TaskCategory> CREATOR = new Parcelable.Creator<TaskCategory>() {
        public TaskCategory createFromParcel(Parcel in) {
            return new TaskCategory(in);
        }

        @Override
        public TaskCategory[] newArray(int size) {
            return new TaskCategory[size];
        }
    };

	public void setId(String id)  {
	    mId = id;
	}

	public String getId()   {
	    return mId;
	}

	public int getNameRes()    {
	    return ConstantsUtils.TaskCategoryRes.mName[mType];
	}

	public void setType(int type)  {
	    mType = type;
	}

	public int getType()   {
	    return mType;
	}

    public void setTasksUndone(int value)  {
        mTasksUnDone = value;
    }

    public int getTasksUndoneProcess()   {
        return mTasksUnDone;
    }

    public int getIconRes()   {
        return ConstantsUtils.TaskCategoryRes.mIcon[mType];
    }

    public int getNumberIconRes(int index) {
        return ConstantsUtils.TaskCategoryRes.mNumber[index];
    }
    
    public int getNumberDoneIconRes(int index) {
        return ConstantsUtils.TaskCategoryRes.mNumberDone[index];
    }

    @Override
    public int describeContents() {
        return 0;
    }
}


